package com.t235.gc.biz.service.impl;

import com.t235.gc.entity.Recyclers;
import com.t235.gc.dao.RecyclersDao;
import com.t235.gc.biz.service.RecyclersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 回收员表(Recyclers)表服务实现类
 *
 * @author makejava
 * @since 2021-03-24 08:45:37
 */
@Service("recyclersService")
public class RecyclersServiceImpl implements RecyclersService {
    @Resource
    private RecyclersDao recyclersDao;

    /**
     * 通过ID查询单条数据
     *
     * @param recyclersid 主键
     * @return 实例对象
     */
    @Override
    public Recyclers queryById(Long recyclersid) {
        return this.recyclersDao.queryById(recyclersid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Recyclers> queryAllByLimit(int offset, int limit) {
        return this.recyclersDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param recyclers 实例对象
     * @return 实例对象
     */
    @Override
    public Recyclers insert(Recyclers recyclers) {
        this.recyclersDao.insert(recyclers);
        return recyclers;
    }

    /**
     * 修改数据
     *
     * @param recyclers 实例对象
     * @return 实例对象
     */
    @Override
    public Recyclers update(Recyclers recyclers) {
        this.recyclersDao.update(recyclers);
        return this.queryById(recyclers.getRecyclersid());
    }

    /**
     * 通过主键删除数据
     *
     * @param recyclersid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long recyclersid) {
        return this.recyclersDao.deleteById(recyclersid) > 0;
    }
}
